import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-05-25
 * Time: 13:30
 */
public class test {
    public static int[] fun(int[] arr){
        int n=0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]==0)
                n++;
        }
        int[] brr=new int[arr.length-n];
        int j=0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]!=0)
                brr[j++]=arr[i];
        }
        return brr;
    }
    public static void main(String[] args) {
        int[] oldArr = {1, 3, 4, 5, 0, 0, 6, 6, 0, 5, 4, 7, 6, 7, 0, 5};
        int[] newArr = fun(oldArr);
        String str = Arrays.toString(newArr);
        System.out.println(str);
    }
}
